Building The Installer

Sunday, February 19, 2023

8:46 AM

During normal OneMore development, you do not need to build the entire solution every time you make a change. The installer, for example only needs to be built when you want an installer. First, build OneMore, OneMoreCalendar, and OneMoreProtocolHandler to get the necessary run-time dependencies. Then you'll typically only need to rebuild OneMore from change to change, making it very quick to iterate.

 

If you've followed the setregistry.ps1 instructions on the Scripts page, then you should be able to continually build and test OneMore without reinstalling or rebuilding the installer. But if you do need to rebuild the installer, keep reading.

 

📓

x86 vs x64 vs ARM64

The OneMore installer that you choose must match the installed architecture of OneNote. If you have OneNote x86 then you must use the x86 installer. If you have OneNote x64 then you must use the x64 installer. If you are running on an ARM64 machine (such as later editions of Microsoft Surface) then use the ARM64 installer.

 

Prep

Prior to running build.ps1 as described below, you must first configure your machine to enable Visual Studio to build Visual Studio Installer Projects (.vdproj) from the command line. It only needs to be run once on your machine, or after a reinstall or upgrade of Visual Studio.

 

From an administrative PowerShell prompt, run this command

 

.\build.ps1 -prep

 

A reboot is recommended after the -prep command.

 

Update SDK

Recommended when pulling down a new clone of the repo to patch the OneMore.csproj file.

 

.\update-sdk.ps1

 

Build The Projects

If you haven't yet built the csproj projects, you can do so from the command line using this command

 

.\build-ps1 -fast

 

At this point, you should have a working version of OneMore.

 

Build The Installer

The setup project is configured to generate a 64-bit Windows installer with the idea that there are very few, if any, 32-bit machines still in use out there. But this 64-bit installer is customized to support both 64-bit and 32-bit installs of OneNote. So one installer to rule them all!

 

However, if a 32-bit installer is needed, use the provided build.ps1 script with the -Architecture x86 argument. This script can be run in three modes.

 

  • .\build.ps1 x86 - builds just the x86 installer
  • .\build.ps1 x64 - builds just the x64 installer; the default if no arguments are provided
  • .\build.ps1 ARM64 - builds just the ARM64 installer

 

There is a fourth mode to build all configurations for a new release of OneMore.

 

  • .\build.ps1 -All - builds the ARM64, x64, and x86 installers, in that order, leaving the x86 build in place for continued development

 

Note that you may see warnings while the installer is building. These are harmless and can be ignored.
 

Debug The Build

To enable msbuild verbose logging, enter this command before runnig build.ps1, where vsregedit is in the same path as devenv.

 

VsRegEdit set local HKCU General MSBuildLoggerVerbosity dword 4

 

This can then be reverted back to a value of 1 when debugging is no longer needed.

 

HRESULT

If the output looks similar to this, with a validation error, you may need to rerun the .\build.ps1 -prep command

 

Microsoft Visual Studio 2022 Version 17.8.3.

Copyright (C) Microsoft Corp. All rights reserved.

Build started at 5:04 PM...

------ Starting pre-build validation for project 'Setup' ------

ERROR: An error occurred while validating.  HRESULT = '8000000A'

------ Pre-build validation for project 'Setup' completed ------

1>------ Build started: Project: Setup, Configuration: Debug ------

========== Build: 0 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========

========== Build completed at 5:04 PM and took 00.201 seconds ==========

 

If that doesn't work then close Visual Studio and retry.

If that doesn't work then reboot. Seriously.

 

 

#omwiki #omdeveloper

 

© 2020 Steven M Cohn. All rights reserved.

Please consider a sponsorship or one-time donation to support ongoing development

 

 

 

Created with OneNote.